| Total Complexity | 1 |
| Total Lines | 19 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import {Controller, Inject, UseGuards, Get, Query} from '@nestjs/common'; |
||
| 12 | |||
| 13 | @Controller('tasks') |
||
| 14 | @ApiTags('Task') |
||
| 15 | @ApiBearerAuth() |
||
| 16 | @UseGuards(AuthGuard('bearer'), RolesGuard) |
||
| 17 | export class GetTasksAction { |
||
| 18 | constructor( |
||
| 19 | @Inject('IQueryBus') |
||
| 20 | private readonly queryBus: IQueryBus |
||
| 21 | ) {} |
||
| 22 | |||
| 23 | @Get() |
||
| 24 | @Roles(UserRole.COOPERATOR, UserRole.EMPLOYEE) |
||
| 25 | @ApiOperation({summary: 'Get all tasks'}) |
||
| 26 | public async index( |
||
| 27 | @Query() pagination: PaginationDTO |
||
| 28 | ): Promise<Pagination<TaskView>> { |
||
| 29 | return await this.queryBus.execute( |
||
| 30 | new GetTasksQuery(pagination.page) |
||
| 31 | ); |
||
| 34 |